package org.example.rabbitmqserver02;

import jakarta.annotation.Resource;
import org.example.rabbitmqserver02.config.RabbitmqConfigTest;
import org.junit.jupiter.api.Test;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.boot.test.context.SpringBootTest;

@SpringBootTest
class RabbitMqServerApplicationTests02 {

	@Resource
	private RabbitTemplate rabbitTemplate;

	@Test
	void sendQueueDirect() {
		//direct测试
		rabbitTemplate.convertAndSend(RabbitmqConfigTest.EXCHANGE_DIRECT, RabbitmqConfigTest.KEY_DIRECT, "direct message");
	}

	@Test
	void sendQueueFanout() {
		//fanout测试
		rabbitTemplate.convertAndSend(RabbitmqConfigTest.EXCHANGE_FANOUT, "", "fanout message");
	}
	@Test
	void sendQueueTopic() {
		//topic测试
		rabbitTemplate.convertAndSend(RabbitmqConfigTest.EXCHANGE_TOPIC, "topic.A.VC.CD", "topic message");
	}

	@Test
	void sendQueueHeaders() {
		//headers测试
		rabbitTemplate.convertAndSend(RabbitmqConfigTest.EXCHANGE_HEADERS, "", "headers message");
	}


}
